package com.mine.redis.util.controller;

import com.mine.redis.util.service.FollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author weixiao
 * @date 2024/8/19 10:25
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    private FollowService followService;

    @PostMapping("/{followId}/{isFollow}")
    public void follow(@PathVariable("followId") Integer followId, @PathVariable("isFollow") Boolean isFollow,
                       @RequestHeader("userId") Integer userId) {
        followService.follow(followId, isFollow, userId);
    }

    @GetMapping("/{followId}")
    public void isFollow(@PathVariable("followId") Integer followId, @RequestHeader("userId") Integer userId) {
        System.out.println(followService.isFollow(followId, userId));
    }

    @GetMapping("/common/{followId}")
    public void common(@PathVariable("followId") Integer followId, @RequestHeader("userId") Integer userId) {
        System.out.println(followService.common(followId, userId));
    }
}
